"""
all Pipe
    img_pipe
    params_pipe

"""
import logging

from flask import Flask, request, redirect, url_for

from .shared_pipes import conn1_params


logger = logging.getLogger(__name__)

app = Flask(__name__)


@app.route(r'/')
def index():
    return redirect(r'/static/index.html')


@app.route('/favicon.ico')
def favicon():
    return redirect(r'/static/favicon.png')
    

def response_img():
    """"""


@app.route(r'/update_params', methods=['POST'])
def update_params():
    """接收新的参数值, 并通过管道发送出去"""
    params = request.form
    params = dict(params)
    
    logger.debug("url /update_params")
    logger.debug(params)
    
    conn1_params.send(params)
    
    
    return redirect(url_for('index'))


